<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('售后工单提成金额设定列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">

           <!-- <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="zsyh:afterCommissionSetting:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="zsyh:afterCommissionSetting:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="zsyh:afterCommissionSetting:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="zsyh:afterCommissionSetting:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('zsyh:afterCommissionSetting:edit')}]];
        var removeFlag = [[${@permission.hasPermi('zsyh:afterCommissionSetting:remove')}]];
        var prefix = ctx + "zsyh/afterCommissionSetting";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                modalName: "售后工单提成金额设定",
                columns: [{
                    field : 'Number',
                    title : '序号',
                    align: 'center',
                    width: 20,
                    formatter : function(value, row, index) {
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;//通过表的#id 可以得到每页多少条
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;//通过表的#id 可以得到当前第几页
                        return pageSize * (pageNumber - 1) + index + 1;//返回每条的序号： 每页条数 * （当前页 - 1 ）+ 序号
                    }
                },
                {
                    field: 'id',
                    title: '提成金额设定id',
                    visible: false
                },
                {
                    field: 'agentCommission',
                    title: '设定省级提成金额'
                },
                {
                    field: 'rakerCommission',
                    title: '设定市县提成金额'
                },
                {
                    field: 'platformCommission',
                    title: '设定平台抽成金额'
                },
                {
                    field: 'premiumMoney',
                    title: '设定每一单的保费'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editSetting(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function editSetting(id) {
            var url = prefix + "/edit/"+id;
            layer.open({
                type: 2,
                area: ['1200px', '600px'],
                fix: false,
                //不固定
                maxmin: true,
                shade: 0.3,
                title: "修改设置",
                content:  url,
                closeBtn: 1,
                // 弹层外区域关闭
                shadeClose: true,
                end: function(){
                    //location.reload();
                },
                cancel: function(index) {
                    //location.reload();
                }
            });
        }

    </script>
</body>
</html>